package com.yangxc.applet.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.yangxc.applet.entity.SysLog;
import com.yangxc.applet.mapper.SysLogMapper;
import com.yangxc.core.log.api.LogDto;
import com.yangxc.core.log.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author yangxc
 * @version 1.0.0
 * @ClassName SysLogServiceImpl.java
 * @Description TODO
 * @createTime 2022年10月10日 11:15:00
 */
@Slf4j
@Component
public class SysLogServiceImpl implements LogService {
    
    @Resource
    SysLogMapper sysLogMapper;
    
    @Async
    @Override
    public void save(LogDto logDto) {
        log.info("日志存储", logDto);
        SysLog sysLog = BeanUtil.toBean(logDto, SysLog.class);
        sysLogMapper.insert(sysLog);
    }
}
